using System;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.BulkCopy
{
	internal abstract class BulkCopyDataSource : IBulkCopyDataSource
	{
		protected ColumnDescribeInfo[] m_columnsMetaData;

		protected OracleBulkCopy m_bulkCopy;

		protected int m_requestedBatchSize;

		internal BulkCopyDataSource(OracleBulkCopy bulkCopy, int requestedBatchSize)
		{
			m_bulkCopy = bulkCopy;
			m_requestedBatchSize = requestedBatchSize;
		}

		protected BulkCopyBindingRow GetBindingRow(int rowIndex, BulkCopyRows rows)
		{
			if (rowIndex > rows.m_bindingRows.Count - 1)
			{
				while (rowIndex > rows.m_bindingRows.Count - 1)
				{
					rows.m_bindingRows.Add(BulkCopyBindingRow.GetFromCache(rows.m_columnCount));
				}
			}
			return rows.m_bindingRows[rowIndex];
		}

		public abstract int GetBatchSize();

		public abstract void Initialize(ColumnDescribeInfo[] destinationColumnsMetaData);

		public abstract int GetColumnCount();

		public abstract int GetColumnOrdinal(string columnName);

		public abstract Type GetSrcColumnType(int columnIndex);

		public abstract int PopulateRows(OracleBulkCopyColumnMappingCollection internalColumnMappings, int numOfRow);

		public abstract int GetRows(OracleBulkCopyColumnMappingCollection internalColumnMappings, int numOfRows, ref BulkCopyRows row);
	}
}
